﻿using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ImageTools
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {

        public List<InterfaceTools> listTool = new List<InterfaceTools>();

        public MainWindow()
        {
            InitializeComponent();

            listTool.Add(new JpegGenToolCtl());
            listTool.Add(new ImageGenCFileToolCtl());

            foreach (InterfaceTools tool in listTool)
            {
                listBox_tools.Items.Add(tool.GetName());
            }
        }

        private void listBox_tools_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var selectedIndex = listBox_tools.SelectedIndex;
            if (selectedIndex == -1)
            {
                return;
            }

            if (this.IsVisible)
            {
                listTool[selectedIndex].InitWidgets(this);
            }
        }
    }
}